<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>The source code</title>
  <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  <style type="text/css">
    .highlight { display: block; background-color: #ddd; }
  </style>
  <script type="text/javascript">
    function highlight() {
      document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
    }
  </script>
</head>
<body onload="prettyPrint(); highlight();">
  <pre class="prettyprint lang-js"><span id='global-property-'>/**
</span> * @ignore
 * load editor's dialog dynamically
 * @author yiminghe@gmail.com
 */
KISSY.add(&quot;editor/plugin/dialog-loader&quot;, function (S, Overlay, Editor) {
    var globalMask,
        loadMask = {
            loading:function (prefixCls) {
                if (!globalMask) {
                    globalMask = new Overlay({
                        x:0,
                        width:S.UA['ie'] == 6 ? S.DOM.docWidth() : &quot;100%&quot;,
                        y:0,
                        // 指定全局 loading zIndex 值
                        &quot;zIndex&quot;:Editor.baseZIndex(Editor.ZIndexManager.LOADING),
                        prefixCls:prefixCls+'editor-',
                        elCls:prefixCls+&quot;editor-global-loading&quot;
                    });
                }
                globalMask.set(&quot;height&quot;, S.DOM.docHeight());
                globalMask.show();
                globalMask.loading();
            },
            unloading:function () {
                globalMask.hide();
            }
        };

    return {
        useDialog:function (editor, name,config, args) {
            // restore focus in editor
            // make dialog remember
            editor.focus();
            var prefixCls=editor.get('prefixCls');
            if (editor.getControl(name + &quot;/dialog&quot;)) {
                setTimeout(function () {
                    editor.showDialog(name, args);
                }, 0);
                return;
            }
            loadMask.loading(prefixCls);
            S.use(&quot;editor/plugin/&quot; + name + &quot;/dialog&quot;, function (S, Dialog) {
                loadMask.unloading();
                editor.addControl(name + &quot;/dialog&quot;, new Dialog(editor,config));
                editor.showDialog(name, args);
            });
        }
    };
}, {
    requires:['overlay', 'editor']
});</pre>
</body>
</html>
